August 24, 2015

Tool Measuring with Centroid TT-2

Primary Services

M51 - Measure height

Calls on the set_h.txt and measure_h.txt macros to measure the height offset for the specified tool, or for the current tool if no tool is specified.

An approximate diameter should be entered in the tool's diameter offset before calling M51. If that diameter is less than 0.400", then length will be measured on centerline, with the spindle stopped. If the preset diameter is 0.400" or more, then length will be measured off-center by the tool radius, and with the spindle turning CCW.

For large drills or ball end mills, the diameter should be preset to zero so that measurement will take place on centerline.

M52 - Measure height and diameter

Calls on the set_hd.txt, measure_h.txt and measure_d.txt macros to measure the height offset and diameter offset for the specified tool, or for the current tool if no tool is specified.

An approximate diameter should be entered in the tool's diameter offset before calling M52. It is used for length measurement as described under the M51 code.

The control also uses the preset diameter in diameter offset measurement: it will add the nominal tool radius when calculating how far to move the Y axis in front and in back of the tool detector, in order to clear before moving in to measure diameter.

For drills and ball end mills larger than about 1/2" (13mm) you will need to call the set_hd.txt or measure_d.txt macro directly, in order to override the side clearance and Z depth for diameter measurement.

M53 - Check for tool breakage

Calls on the chk_brk.txt macro to check a previously measured tool for breakage.

This routine will rapid up and over the detector; move quickly down to within 1mm of the detector; then move down until the tool touches the detector or reaches a position 0.2mm below the expected contact point. If the tool reaches that position without contact, then it is presumed broken and the CNC program cycle is canceled.

If the tool is okay, then this routine rapids back up, over, and down to the previous location. Most G code modal conditions (coordinate system, feedrate, movement mode, spindle speed) are restored. However, spindle rotation is not restarted, and canned cycles (e.g. drilling, boring, tapping) are not restored. The CNC program will have to repeat the M3 code and, if needed, canned cycle code after calling M53.

Secondary Services

set_h.txt - Measure height

Called from M51; see M51 description for details.

If set_h.txt is to be called directly from a CNC program, it will need to be called by its full path name. E.g.

G65 "c:\cncm\set_h.txt" T10

set_hd.txt - Measure height and diameter

Called from M52; see M52 description for details.

If set_hd.txt is to be called directly from a CNC program, it will need to be called by its full path name. E.g.

G65 "c:\cncm\set_hd.txt" T10

SET_HD accepts an optional Z position, to override the default diameter measuring depth; and an optional R distance, to override the default radial clearance when positioning the tool in front and in back of the detector, prior to measuring diameter. These values are needed when measuring larger drills and ball mills.

For example, if you are measuring height and diameter for a 1" ball end mill, you will want to preset the diameter offset to zero so that length measurement is done on centerline. But you would then need to tell SET_HD that it needs at least a half inch extra clearance to get the tool in front or back of the detector (remember, SET_HD would otherwise think your 1" diameter tool has zero diameter). You would also need to tell SET_HD to go down at least a half inch to get a valid diameter measurement. E.g.

G10 D12 R0  ; preset tool 12 diameter to zero
G65 "c:\cncm\set_hd.txt" T12 R0.6 Z-0.6   ; measure height and diameter

If you do not override R, then the default radial clearance is 4mm plus half of the tool's preset diameter (leaving approximately 4mm clearance).

If you do not override Z, then the default Z depth for measuring tool diameter is with the tool tip 4mm below the top of the tool detector stylus (i.e. about half way down the side of the stylus).

chk_brk.txt - Check for tool breakage

Called from M53; see M53 description for details.

If chk_brk.txt is to be called directly from a CNC program, it will need to be called by its full path name. E.g.

G65 "c:\cncm\chk_brk.txt" T10

Underlying Routines

measure_h.txt - Measure height offset

Called through SET_H and SET_HD macros; may also be called directly with G65.

measure_d.txt - Measure diameter offset

Called through SET_HD macro; may also be called directly with G65.

unit_conv.txt - Set unit conversion variables

Called from other routines, in order to set the following variables

#29 = multiplier to convert millimeters to user units (user units per millimeter)

#31 = multiplier to convert inches to user units (user units per inch)

#33 = multiplier to convert default machine units to user units

If a routine wants to execute a move with a distance or feedrate known in millimeters, it should multiply by #29. E.g. to move X incrementally 2mm at 4mm/min:

G1 G91 X[2.0*#29] F[4.0*#29]

If a routine wants to execute a move with a distance or feedrate known in inches, it should multiply by #31. E.g. to move X incrementally by the amount stored in variable P960 (which is always in inches) at 10 in/min:

G1 G91 X[#9960*#31] F[10.0*#31]

Files

All the macro files for these services are located in the c:\cncm directory. Files are:

mfunc51.mac
mfunc52.mac
mfunc53.mac
set_h.txt
set_hd.txt
chk_brk.txt
unit_conv.txt
measure_h.txt
measure_d.txt

Detector Location

The TT-2 should be located in a fixed position on the machine table.

Work Coordinate System (WCS) #18 (the E18 or G54P12 coordinate system) is reserved for the location of the TT-2. Set WCS #18 X and Y zero over the center of the TT-2. Set WCS #18 Z zero at machine zero (top of travel).

Tool height offsets will be measured as distances down from machine zero.

Calibration

Diameter measurement depends on a calibrated stylus diameter, stored in Machine Parameter 960. This value is saved with the rest of the Machine Parameters, in the file cncm.prm.xml. In the unlikely event cncm.prm.xml is corrupted or deleted, the control will display a warning on startup (e.g. "Error loading parameter file: Using default parameters"). In that case Parameter 960 will be reset to zero. You must reenter the appropriate value before attempting tool diameter measurements.

You can set Parameter 960 on the Configuration -> Machine Parameters screen, or by using the MDI prompt. To set it to a known value, use G10 for a simple assignment. E.g.

G10 P960 R0.5

To change it by some amount, without necessarily knowing its value, enter a G10 code with a calculated value. E.g.

G10 P960 R[#9960 - 0.0015]

To view the current value stored in Parameter 960, see the Configuration -> Machine Parameters screen.

The stylus diameter you store in Parameter 960 should always be in inches, even when the control has been changed over to run in millimeters.

To determine the necessary value or adjustment for P960, simply use M52 or set_hd.txt to measure the height and diameter of a tool with a precise known diameter (e.g. a length of drill rod, which you have confirmed has zero runout in the tool holder). Compare the resulting diameter stored in the offset library with the known tool diameter. If the measured diameter is less than the actual diameter, you need to make P960 smaller by the amount of the error. If the measured diameter is more than the actual diameter, you need to make P960 larger by the amount of the error.